package com.collectplus.express.logic;

import com.collectplus.express.ExpressApplication;

import droid.frame.utils.android.Log;
import droid.frame.utils.http.HttpClient;

public class AppConfig extends droid.frame.Config {

    // 用来标记调用哪个服务器  0 测试服务器  1 正式服务器  2 咖啡电脑
    public static int defaultService = 0;

    static {
        init();
    }

    /**
     * {@link ExpressApplication#onCreate() 的先初始化全局变量}
     */
    public static void init() {
        //设置网络请求加密
        HttpClient.isRAS = true;
        isTest = false;
        if (isTest) {
            Log.setOpen(true);
        } else {
            Log.setOpen(true);
        }
    }

    //上传图片或文件
    public final static String file_url = "http://files.shouhuobao.com:8080/fileUpload/fileUpload/product";
    public final static String file_url_test = "http://files.shouhuobao.com:8080/fileUpload/fileUpload/test";

    //暂时没什么用，不清楚具体作用
    private static final String SERVER_URL_WX = "http://weixin.bhi.shouhuobao.com/emove-weixin/";
    private static final String SERVER_URL_WX_test = "http://test.weixin.bhi.shouhuobao.com/emove-weixin/";

    // 测试
    //    public static String SERVER_URL_test = "http://123.56.87.34:8080/guoer-appserv/";
    public static String SERVER_URL_test = "https://jk.shouhuobao.com/guoer-appserv/";
    //    public static String SERVER_URL_test = "http://10.100.0.43:8090/guoer-appserv/";
//        public static String SERVER_URL_test = "http://10.100.0.100:80/guoer-appserv/";

    //	private static final String SERVER_URL_test = "http://123.56.87.34:80/guoer-appserv/";

    //我的电脑
    //    private static final String SERVER_URL_test = "http://10.100.0.3:80/";

    //    private static final String SERVER_URL = "http://test.emove.shouhuobao.com:80/guoer-appserv/";
    private static final String SERVER_URL = "https://guor.shouhuobao.com/guoer-appserv/";
//    public static String SERVER_URL_test = "https://guor.shouhuobao.com/guoer-appserv/";
    //    private static final String SERVER_URL = "https://guor2018.shouhuobao.com/guoer-appserv/";

    // private static final String SERVER_URL = "http://182.92.190.64:80/guoer-appserv/";

    // private static final String SERVER_URL = "http://guoer.shouhuobao.com:9980/guoer-appserv/";

    // 返回服务区的url
    public static final String getServiceInfoUrl() {
        return AppConfig.getServerUrl() + "static/html/serviceintro.html";
    }

    /**
     * 快递公司ID 如果是添加包裹的界面咋传入0
     *
     * @param companyId
     * @return
     */
    public static final String getExpressCompanyUrl(int companyId) {
        if (companyId == 0) {
            return AppConfig.getServerUrl() + "static/html/priceCheck.html?";
        } else {
            return AppConfig.getServerUrl() + "static/html/editPrice.html?";
        }
    }

    public static final String getServerUrl() {
        if (isTest) {
            return SERVER_URL_test;
        }
        return SERVER_URL;
    }

    /**
     * 文件上传
     *
     * @return
     */
    public static final String getFileUrl() {
        if (isTest) {
            return file_url_test;
        }
        return file_url;
    }

    /**
     * 微信分享的URL
     *
     * @return
     */
    public static final String getServerWXUrl() {
        // if (isTest) {
        // return SERVER_URL_WX_test;
        // }
        return SERVER_URL_WX;
    }

    public static int getBadiuLocBeat() {
        return 1000 * 60 * 5; // 5分钟
    }

    public static int getDefaultService() {
        return defaultService;
    }

    /**
     * 已到店、已取走、已寄出url
     *
     * @return
     */
    public static final String getDefaultParcelInfoUrl() {
        return AppConfig.getServerUrl() + "static/html/mypackage.html";
    }

    /**
     * 配置衡水坐标和城市名称  0 正常定位城市，不为0的是设置的固定城市  1 衡水  2 德州
     */
    public static int isOtherCity = 0;

    /**
     * 衡水的坐标
     */
    public static double getOhterCityLat() {
        if (isOtherCity == 1) {
            return 37.731568;
        } else if (isOtherCity == 2) {
            return 37.469196;
        }
        return 0.00;
    }

    public static double getOhterCityLng() {
        if (isOtherCity == 1) {
            return 115.657797;
        } else if (isOtherCity == 2) {
            return 116.309867;
        }
        return 0.00;
    }

    public static String getCityName() {
        if (isOtherCity == 1) {
            return "衡水市";
        } else if (isOtherCity == 2) {
            return "德州市";
        }
        return "";
    }

    public static String getProvince() {
        if (isOtherCity == 1) {
            return "河北省";
        } else if (isOtherCity == 2) {
            return "山东省";
        }
        return "";
    }

    public static String getDistrict() {
        if (isOtherCity == 1) {
            return "桃城区宁安路1号";
        } else if (isOtherCity == 2) {
            return "德城区";
        }
        return "";
    }

    public static String getAddress() {
        if (isOtherCity == 1) {
            return "宁安路1号";
        } else if (isOtherCity == 2) {
            return "青年路1011号附近";
        }
        return "";
    }


    //    public static void setSERVER_URL_test(String host) {
    //        SERVER_URL_test = host;
    //    }
}
